<template>

	<view class="main">
		<image class="ysa" style="width: 100%;height: 600rpx;position: fixed;top: 0;" src="/static/images/ysa.png"></image>

		<u-navbar :bgColor="bgColor" :fixed="false" title="预约详情" placeholder="true" @rightClick="rightClick" :autoBack="true"></u-navbar>

		<view class="info">

			<view class="header">
				<view class="row_a_c">
					<view class="xinga"></view>
					<text class="header-title">我的预约信息</text>
				</view>
			</view>


			<view class="container">

				<view class="card column_c">

					<view class="card-content">
						<view class="row_a_c space-between">
							<text class="clinic">{{item.store.name}}</text>
							<text v-if="item.status==1" class="status success center">已预约</text>
							<text v-if="item.status==2" class="status success center">已取消</text>
							<text v-if="item.status==3" class="status success center">已到店</text>
							<text v-if="item.status==4" class="status success center">已完结</text>
						</view>

						<view class="appointment-info">
							<view class="name">预约姓名：{{item.name}}</view>
							<view class="time">计划到店时间：{{item.arrival_at}}</view>
							<view class="phone">预约电话：{{item.phone}}</view>
						</view>


						<text class="note">手机号码为到院就诊凭证，请确保预约电话的准确性。</text>

						<view class="appointment-info">
							<view class="time">到店时间：{{item.arrival_at}}</view>
							<view class="time">口腔情况：{{item.detail}}</view>
							<view class="time">预约门店：{{item.store.name}}</view>
							<view class="time">提交时间：{{item.created_at}}</view>
						</view>


						<u-line margin="20rpx 0"></u-line>
						<view class="actions" v-if="item.status==1">
							<button class="yqbut" @click="orderCancelFuc()">取消预约</button>
						</view>
					</view>

				</view>

			</view>







		</view>
	</view>

</template>

<script>
	import api_index from '@/api/index.js';

	export default {
		components: {

		},
		onLoad(options) {
			if (options.item) {
				// 解析传递过来的数据
				this.item = JSON.parse(decodeURIComponent(options.item));
				console.log('aaabbbccc', this.item);
			}
		},
		async onShow() {

		},

		data() {
			return {
				bgColor: 'rgba(0, 31, 63, 0)',
				item: null,
			};
		},
		methods: {
			//取消预约
			async orderCancelFuc() {
				var per = {
					order: this.item.id,
				}
				const res = await api_index.orderCancel(per);
				if (res.code == 1) {
					this.$util.msg('取消成功');
					setTimeout(() => {
						this.navTo("/pages/zxhd/yyjl");
					}, 1000);
				} else {
					this.$util.msg(res.message);
					return;
				}
			},

		}
	};
</script>

<style scoped lang="scss">
	.main {}

	.info {
		width: 100%;

		min-height: 1000rpx;
		background: #FFFFFF;
		border-radius: 40rpx 40rpx 0rpx 0rpx;
		position: absolute;

		top: 540rpx;
		padding: 50rpx 32rpx 32rpx 32rpx;
	}


	.form-container {
		padding: 20rpx;
		background-color: #ffffff;
		border-radius: 16rpx;
	}

	.header {
		margin-bottom: 20rpx;
	}

	.xinga {
		width: 6rpx;
		height: 24rpx;
		background: #1FA194;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		margin-right: 10rpx;
	}



	.header-title {
		font-size: 28rpx;
		font-weight: bold;
		color: #1CC09B;
	}



	.container {
		padding: 20px;
	}

	.card {
		background-color: #fff;
		border-radius: 8px;
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
		margin-bottom: 20px;
	}

	.card-header {
		display: flex;
		justify-content: space-between;
		padding: 10px;
		border-bottom: 1px solid #f0f0f0;
	}

	.status {
		width: 92rpx;
		height: 32rpx;
		background: #1FA194;
		border-radius: 4rpx 4rpx 4rpx 4rpx;


		font-weight: 400;
		font-size: 20rpx;
		color: #FFFFFF;

	}


	.cancelled {
		color: #f44336;
	}

	.card-content {
		width: 686rpx;
		min-height: 400rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 0rpx 8rpx -2rpx rgba(0, 0, 0, 0.04), 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.03), 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.02);
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		padding: 32rpx;
	}

	.clinic {
		font-weight: bold;
		font-size: 28rpx;
		color: rgba(0, 0, 0, 0.85);


	}

	.name {

		font-weight: 400;
		font-size: 24rpx;
		color: rgba(0, 0, 0, 0.6);
		margin-bottom: 12rpx;

	}

	.time {

		font-weight: 400;
		font-size: 24rpx;
		color: rgba(0, 0, 0, 0.6);
		margin-bottom: 12rpx;


	}

	.phone {

		font-weight: 400;
		font-size: 28rpx;
		color: #1FA194;
		margin-bottom: 12rpx;



	}

	.appointment-info {
		margin-top: 24rpx;
	}

	.note {

		font-weight: 400;
		font-size: 24rpx;
		color: #1FA194;

	}

	.actions {
		margin-left: 400rpx;
	}

	.yqbut {
		width: 192rpx;
		height: 52rpx;
		border-radius: 26rpx 26rpx 26rpx 26rpx;
		border: 2rpx solid #DCDCDC;


		font-weight: 400;
		font-size: 28rpx;
		color: rgba(0, 0, 0, 0.4);
		line-height: 44rpx;

	}

	.kfbut {
		width: 192rpx;
		height: 52rpx;
		border-radius: 26rpx 26rpx 26rpx 26rpx;
		border: 2rpx solid #91F6E8;


		font-weight: 400;
		font-size: 28rpx;
		color: #27CCBB;
		line-height: 44rpx;


	}
</style>